package com.leyou.page.handler;

import com.leyou.page.entity.SkuPO;
import com.leyou.page.service.GoodsPageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import top.javatool.canal.client.annotation.CanalTable;
import top.javatool.canal.client.handler.EntryHandler;


@Component
@CanalTable(value = "tb_sku")
public class SkuHandler implements EntryHandler<SkuPO> {

    @Autowired
    private GoodsPageService pageService;

    @Override
    public void insert(SkuPO skuPO) {
        pageService.loadSkuListData(skuPO.getSpuId());
    }

    @Override
    public void update(SkuPO before, SkuPO after) {
        System.out.println("before ");
        pageService.loadSkuListData(after.getSpuId());
    }

    @Override
    public void delete(SkuPO skuPO) {
        pageService.deleteSkuList(skuPO.getSpuId());
    }
}
